package com.amos.generate.web;

import com.amos.generate.service.GenerateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright © 2018 五月工作室. All rights reserved.
 *
 * @Package com.amos.generate.web
 * @ClassName CodeGenerateController
 * @Description TODO
 * @Author Amos
 * @Modifier
 * @Date 2020/3/9 22:45
 * @Version 1.0
 **/
@RestController
@RequestMapping(value = "/generate")
public class CodeGenerateController {

    @Autowired
    GenerateService generateService;

    @GetMapping(value = "/code")
    public String generate(@RequestParam("path") String path,
                           @RequestParam("packageName") String packageName,
                           @RequestParam("tableName") String tableName,
                           @RequestParam("isPage") Boolean isPage) throws Exception {
        generateService.generateCode(path,packageName,tableName,isPage);
        return "ok";
    }
}
